using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class ActiveYellowScript : System.Web.UI.UserControl
{

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            MultiView1.SetActiveView(View1);
            prevpage.Text = "View1";
        }
        else
        {
        }

        lblAgentFirst.Text = Session["agentfirst"].ToString();

    }

    protected void rblNav_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (this.rblNav.SelectedItem.Value == "FAQ")
        {
            prevpage.Text = MultiView1.ActiveViewIndex.ToString();
            MultiView1.SetActiveView(View3);
            return;
        }
        if (this.rblNav.SelectedItem.Value == "CInfo")
        {
            MultiView1.SetActiveView(View1);
            return;
        }
    }
    protected void rblOrderReq_SelectedIndexChanged(object sender, EventArgs e)
    {
        Button1.Enabled = true;
        if (rblOrderReq.SelectedItem.Value == "yes")
        {
            Button1.Visible = true;
            Button1.Text = "Next";
            Button1.CommandName = "NextView";
        }
        if (rblOrderReq.SelectedItem.Value == "no")
        {
            Button1.Visible = false;
            // Button1.Text = "Finish";
            //Button1.CommandName = "";
        }
    }
    protected void MultiView1_ActiveViewChanged(object sender, EventArgs e)
    {

        /*  View lastview = (View)sender;
          if (lastview.ID == "page1")
          {
              btnFAQ.CommandArgument = "View2";
          }
          else if (lastview.ID == "page2")
          {
              btnFAQ.CommandArgument = "View2";
          }*/
      
            switch (MultiView1.ActiveViewIndex)
            {
                case 0:
                    rblNav.Items[0].Selected = true;
                    rblNav.Items[1].Selected = false;
                    btnDisposition.Visible = true;
                    break;
                case 1:
                    btnDisposition.Visible = true;
                    break;
                case 2:
                    rblNav.Items[1].Selected = true;
                    rblNav.Items[0].Selected = false;
                    btnDisposition.Visible = false;
                    break;
                case 3:
                    rblNav.Visible = false;
                    btnDisposition.Visible = false;
                    break;
            }
        
    }

    protected void btnFAQ_Click(object sender, EventArgs e)
    {
        btnFAQ.CommandArgument = prevpage.Text;

        //if (rblOrderReq.SelectedIndex > -1)
        //{
        //    if (rblOrderReq.SelectedItem.Value == "yes")
        //    {
        //        btnFAQ.CommandArgument = "View2";
        //    }
        //    else
        //    {
        //        btnFAQ.CommandArgument = "View1";
        //    }
        //}

    }
    protected void btnDisposition_Click(object sender, EventArgs e)
    {
        
        ((DataAccess)Session["App"]).PutCallData("FirstName", tbFName.Text);
        ((DataAccess)Session["App"]).PutCallData("LastName", tbLName.Text);
        ((DataAccess)Session["App"]).PutCallData("Zipcode", tbZip.Text);
        ((DataAccess)Session["App"]).PutCallData("PrimaryPhone", tbPhone.Text);
        ((DataAccess)Session["App"]).PutCallData("AYOrderNumber", tbOrderNum.Text);
        ((DataAccess)Session["App"]).CommitCallData();
        MultiView1.SetActiveView(View4);
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        //System.Web.UI.WebControls.View 
        prevpage.Text = MultiView1.ActiveViewIndex.ToString();

    }
}